package com.ruoyi.user.controller;

import com.ruoyi.common.core.cg.result.Result;
import com.ruoyi.user.service.MyWxService;
import me.chanjar.weixin.common.service.WxService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("wx")
public class WxController {
    @Autowired
    private MyWxService service;
    @Autowired
    private WxService wxService;
    @RequestMapping("getAccessToken")
    public Result getAccessToken(){
        try {
            
            return service.getAccessToken();
        }catch (Exception e){
            e.printStackTrace();
            return new Result(false,"查询失败");
        }
    }

    /**
     * 生成二维码
     * @param onumber
     * @return
     */
    @RequestMapping("generateCodeUrl")
    public Result generateCodeUrl(String onumber){
        try {
            return service.generateCodeUrl(onumber);
        }catch (Exception e){
            e.printStackTrace();
            return new Result(false,"生成支付二维码失败");
        }
    }

}
